Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.drawImage = function (e, t) {
    return n.apply(this, arguments);
  });
var e,
  t =
    (e = require("../@babel/runtime/regenerator")) && e.__esModule
      ? e
      : { default: e },
  r = require("../@babel/runtime/helpers/asyncToGenerator");
function n() {
  return (n = r(
    t.default.mark(function e(r, n) {
      var i, o, h, g, s, l, u;
      return t.default.wrap(function (e) {
        for (;;)
          switch ((e.prev = e.next)) {
            case 0:
              return (
                wx.showLoading({ title: "加载中" }),
                (i = r.src),
                (o = n.ctx),
                (h = n.canvas),
                (g = n.dpr),
                (e.next = 5),
                c(
                  "".concat(
                    n.CDN,
                    "/background/1688367706997_4MrbN965.jpg?imageMogr2/format/webp/ignore-error/1",
                  ),
                  n,
                )
              );
            case 5:
              return (
                (s = e.sent),
                o.drawImage(s, 0, 0, h.width / g, h.height / g),
                o.restore(),
                (e.next = 10),
                c(i, n)
              );
            case 10:
              return (
                (l = e.sent),
                o.drawImage(
                  l,
                  (43 / 375) * (h.width / g),
                  (124 / 730) * (h.height / g),
                  (h.width / g) * (288.5 / 375),
                  (h.height / g) * (385 / 730),
                ),
                o.restore(),
                (e.next = 15),
                c(
                  "".concat(
                    n.CDN,
                    "/card-bg/1686797830983_zw2irACM.png?imageMogr2/format/webp/ignore-error/1",
                  ),
                  n,
                )
              );
            case 15:
              (u = e.sent),
                o.drawImage(
                  u,
                  (26 / 375) * (h.width / g),
                  (60 / 730) * (h.height / g),
                  (322 / 375) * (h.width / g),
                  (465 / 730) * (h.height / g),
                ),
                o.restore(),
                a(r, n);
            case 19:
            case "end":
              return e.stop();
          }
      }, e);
    }),
  )).apply(this, arguments);
}
function a(e, t) {
  return i.apply(this, arguments);
}
function i() {
  return (i = r(
    t.default.mark(function e(r, n) {
      var a, i, h, g, s;
      return t.default.wrap(function (e) {
        for (;;)
          switch ((e.prev = e.next)) {
            case 0:
              return (
                (a = n.ctx),
                (i = n.canvas),
                (h = n.dpr),
                (g = r.desc),
                (e.next = 4),
                c(n.CDN + g, n)
              );
            case 4:
              (s = e.sent),
                a.drawImage(
                  s,
                  (59 / 375) * (i.width / h),
                  (148 / 730) * (i.height / h),
                  (i.width / h) * 0.128,
                  (i.height / h) * (216 / 730),
                ),
                a.restore(),
                o(r, n);
            case 8:
            case "end":
              return e.stop();
          }
      }, e);
    }),
  )).apply(this, arguments);
}
function o(e, t) {
  return h.apply(this, arguments);
}
function h() {
  return (h = r(
    t.default.mark(function e(r, n) {
      var a, i, o, h, s, l, u, d;
      return t.default.wrap(function (e) {
        for (;;)
          switch ((e.prev = e.next)) {
            case 0:
              return (
                (a = r.no),
                (i = r.time),
                (o = n.ctx),
                (h = n.canvas),
                (s = n.dpr),
                (o.fillStyle = "#FFF0BD"),
                (o.font = "".concat(g(10), "px PingFang SC")),
                (o.globalAlpha = 0.6),
                o.fillText(
                  "NO.".concat(a),
                  (59 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (236 / 730),
                ),
                o.restore(),
                (e.next = 9),
                c(
                  "".concat(
                    n.CDN,
                    "/qr-code/1686803249121_TSSznema.png?imageMogr2/format/webp/ignore-error/1",
                  ),
                  n,
                )
              );
            case 9:
              return (
                (l = e.sent),
                o.drawImage(
                  l,
                  (h.width / s) * 0.72,
                  h.height / s - (h.height / s) * (190 / 730),
                  (h.width / s) * (62 / 375),
                  (h.height / s) * (62 / 730),
                ),
                o.restore(),
                (o.fillStyle = "#FFF0BD"),
                (o.font = "".concat(g(9), "px PingFang SC")),
                (o.globalAlpha = 0.6),
                o.fillText(
                  "扫码查看",
                  (283 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (114 / 730),
                ),
                o.restore(),
                (o.fillStyle = "#FFF0BD"),
                (o.font = "".concat(g(12), "px PingFang SC")),
                (o.globalAlpha = 0.6),
                o.fillText(
                  i,
                  (43 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (130 / 730),
                ),
                o.restore(),
                (o.fillStyle = "#FFF0BD"),
                (o.font = "".concat(g(12), "px PingFang SC")),
                (o.globalAlpha = 0.6),
                o.fillText(
                  "在三星堆博物馆打卡了这件藏品",
                  (43 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (150 / 730),
                ),
                o.restore(),
                (e.next = 29),
                c(
                  "".concat(
                    n.CDN,
                    "/circle/1688552085969_eG6pp6yM.png?imageMogr2/format/webp/ignore-error/1",
                  ),
                  n,
                )
              );
            case 29:
              return (
                (u = e.sent),
                o.drawImage(
                  u,
                  (43 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (190 / 730),
                  (h.width / s) * (20 / 375),
                  (h.height / s) * (20 / 730),
                ),
                o.restore(),
                (o.fillStyle = "#FFF0BD"),
                (o.font = "".concat(g(12), "px PingFang SC")),
                (o.globalAlpha = 1),
                o.fillText(
                  n.name,
                  (71 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (175 / 730),
                ),
                o.restore(),
                o.save(),
                o.beginPath(),
                (e.next = 41),
                c(
                  "".concat(
                    n.headImg,
                    "?imageMogr2/format/webp/ignore-error/1",
                  ),
                  n,
                )
              );
            case 41:
              (d = e.sent),
                o.arc(
                  (53 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (180 / 730),
                  g(9.5),
                  0,
                  2 * Math.PI,
                ),
                o.clip(),
                o.drawImage(
                  d,
                  (43 / 375) * (h.width / s),
                  h.height / s - (h.height / s) * (190 / 730),
                  (h.width / s) * (20 / 375),
                  (h.width / s) * (20 / 375),
                ),
                o.clip(),
                o.restore(),
                o.save(),
                wx.canvasToTempFilePath({
                  canvas: n.canvas,
                  success: function (e) {
                    wx.showShareImageMenu({
                      path: e.tempFilePath,
                      success: function (e) {
                        console.log(e, "success");
                      },
                    });
                  },
                  fail: function (e) {
                    console.log(e, "fail");
                  },
                }),
                wx.hideLoading();
            case 50:
            case "end":
              return e.stop();
          }
      }, e);
    }),
  )).apply(this, arguments);
}
function c(e, t) {
  var r = t.canvas;
  return (
    (t.ctx.globalAlpha = 1),
    new Promise(function (t, n) {
      var a = r.createImage();
      (a.onload = function () {
        t(a);
      }),
        (a.onerror = function () {
          n(new Error("fail to fetch image from: ".concat(e)));
        }),
        (a.src = e);
    })
  );
}
function g(e) {
  var t;
  return null !== (t = wx.getSystemInfoSync()) && void 0 !== t && t.windowWidth
    ? (e * wx.getSystemInfoSync().windowWidth) / 375
    : e;
}
